/* -*- C++ -*- */

//=============================================================================
/*
* @author Feloweria <380374483@qq.com>
* Copyright (C) Feloweria
*
* $ID 2014-05-14 11:24:02 AM
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details
*
* You should have received a copy of the GNU General Public License
* along with this program.  If not, see <http://www.gnu.org/licenses/>.
*
* @version 1.0
*/
//=============================================================================
#ifndef FLOWRIA_SOCKET_THREAD_INCLUDE
#define FLOWRIA_SOCKET_THREAD_INCLUDE

#include "Network/Socket.h"
#include "Thread/Thread.h"

FELOWRIA_BEGIN

class DLL_EXPORT SocketThread :public Thread
{
public:
	SocketThread();
	~SocketThread();

public:
	bool Register(Socket *socket);
	bool UnRegister(Socket *socket);

public:
	virtual bool Excute();

public:
	int32 Size() const;

public:
	bool IsFull() const;
	
private:
	int32 size;

private:
#ifdef __LINUX__
	int32 fd;
#endif

#ifdef __WINDOWS__
	HANDLE completion_port;
#endif
private:
	static int32 max_size;
};

FELOWRIA_END

#include "SocketThread.inl"

#endif // FLOWRIA_SOCKET_THREAD_INCLUDE
